/**
 * 初始化患者就诊信息详情对话框
 */
var CdcEpisodeInfoDlg = {
    validateFields: {
    	xcode: {
            validators: {
                notEmpty: {
                    message: '索引码不能为空'
                }
            }
        },
    	episodeNum: {
            validators: {
                notEmpty: {
                    message: '就诊流水号不能为空'
                }
            }
        },
    	patientCode: {
            validators: {
                notEmpty: {
                    message: '患者主索引不能为空'
                }
            }
        },
    	busAdmTypeId: {
            validators: {
                notEmpty: {
                    message: '就诊类型不能为空'
                }
            }
        },
    	busAdmStatusId: {
            validators: {
                notEmpty: {
                    message: '就诊状态不能为空'
                }
            }
        },
    	healthCode: {
            validators: {
                notEmpty: {
                    message: '电子健康码不能为空'
                }
            }
        },
    	name: {
            validators: {
                notEmpty: {
                    message: '姓名不能为空'
                }
            }
        },
    	gender: {
            validators: {
                notEmpty: {
                    message: '性别不能为空'
                }
            }
        },
    	nationality: {
            validators: {
                notEmpty: {
                    message: '国籍不能为空'
                }
            }
        },
    	nation: {
            validators: {
                notEmpty: {
                    message: '民族不能为空'
                }
            }
        },
    	birthdate: {
            validators: {
                notEmpty: {
                    message: '出生日期不能为空'
                }
            }
        },
    	age: {
            validators: {
                notEmpty: {
                    message: '年龄不能为空'
                }
            }
        },
    	cardType: {
            validators: {
                notEmpty: {
                    message: '证件类型不能为空'
                }
            }
        },
    	cardValue: {
            validators: {
                notEmpty: {
                    message: '证件号码不能为空'
                }
            }
        },
    	nativePlace: {
            validators: {
                notEmpty: {
                    message: '籍贯不能为空'
                }
            }
        },
    	company: {
            validators: {
                notEmpty: {
                    message: '工作单位不能为空'
                }
            }
        },
    	telephone: {
            validators: {
                notEmpty: {
                    message: '电话不能为空'
                }
            }
        },
    	email: {
            validators: {
                notEmpty: {
                    message: '邮箱不能为空'
                }
            }
        },
    	contactor: {
            validators: {
                notEmpty: {
                    message: '联系人不能为空'
                }
            }
        },
    	contactorPhone: {
            validators: {
                notEmpty: {
                    message: '联系人电话不能为空'
                }
            }
        },
    	career: {
            validators: {
                notEmpty: {
                    message: '职业不能为空'
                }
            }
        },
    	bloodAbo: {
            validators: {
                notEmpty: {
                    message: '血型ABO不能为空'
                }
            }
        },
    	bloodRh: {
            validators: {
                notEmpty: {
                    message: '血型Rh不能为空'
                }
            }
        },
    	registNum: {
            validators: {
                notEmpty: {
                    message: '登记号不能为空'
                }
            }
        },
    	mrNum: {
            validators: {
                notEmpty: {
                    message: '病案号不能为空'
                }
            }
        },
    	nativeProvince: {
            validators: {
                notEmpty: {
                    message: '户籍所在地省不能为空'
                }
            }
        },
    	nativeCity: {
            validators: {
                notEmpty: {
                    message: '户籍所在地市不能为空'
                }
            }
        },
    	nativeCounty: {
            validators: {
                notEmpty: {
                    message: '户籍所在地县不能为空'
                }
            }
        },
    	nativeTown: {
            validators: {
                notEmpty: {
                    message: '户籍所在地乡不能为空'
                }
            }
        },
    	nativeAddress: {
            validators: {
                notEmpty: {
                    message: '户籍所在地详细描述不能为空'
                }
            }
        },
    	nowProvince: {
            validators: {
                notEmpty: {
                    message: '现住址所在地省不能为空'
                }
            }
        },
    	nowCity: {
            validators: {
                notEmpty: {
                    message: '现住址所在地市不能为空'
                }
            }
        },
    	nowCounty: {
            validators: {
                notEmpty: {
                    message: '现住址所在地县不能为空'
                }
            }
        },
    	nowTown: {
            validators: {
                notEmpty: {
                    message: '现住址所在地乡不能为空'
                }
            }
        },
    	nowAddress: {
            validators: {
                notEmpty: {
                    message: '现住址详细描述不能为空'
                }
            }
        },
    	isDeath: {
            validators: {
                notEmpty: {
                    message: '死亡标志不能为空'
                }
            }
        },
    	deathDate: {
            validators: {
                notEmpty: {
                    message: '死亡日期不能为空'
                }
            }
        },
    	admNums: {
            validators: {
                notEmpty: {
                    message: '住院次数不能为空'
                }
            }
        },
    	admDate: {
            validators: {
                notEmpty: {
                    message: '入院日期不能为空'
                }
            }
        },
    	admLocId: {
            validators: {
                notEmpty: {
                    message: '就诊科室不能为空'
                }
            }
        },
    	admLocDesc: {
            validators: {
                notEmpty: {
                    message: '就诊科室Desc不能为空'
                }
            }
        },
    	admWardId: {
            validators: {
                notEmpty: {
                    message: '就诊病区不能为空'
                }
            }
        },
    	admWardDesc: {
            validators: {
                notEmpty: {
                    message: '就诊病区Desc不能为空'
                }
            }
        },
    	admRoom: {
            validators: {
                notEmpty: {
                    message: '就诊房间不能为空'
                }
            }
        },
    	admBed: {
            validators: {
                notEmpty: {
                    message: '就诊床位不能为空'
                }
            }
        },
    	admDoctorId: {
            validators: {
                notEmpty: {
                    message: '主管医生不能为空'
                }
            }
        },
    	admDoctorName: {
            validators: {
                notEmpty: {
                    message: '主管医生姓名不能为空'
                }
            }
        },
    	dishDate: {
            validators: {
                notEmpty: {
                    message: '出院日期不能为空'
                }
            }
        },
    	admDays: {
            validators: {
                notEmpty: {
                    message: '住院天数不能为空'
                }
            }
        },
    	isNewly: {
            validators: {
                notEmpty: {
                    message: '是否初诊不能为空'
                }
            }
        },
    	isNewborn: {
            validators: {
                notEmpty: {
                    message: '是否新生儿不能为空'
                }
            }
        },
    	bornWeight: {
            validators: {
                notEmpty: {
                    message: '新生儿出生体重(g)不能为空'
                }
            }
        },
    	admWeight: {
            validators: {
                notEmpty: {
                    message: '新生儿入院体重(g)不能为空'
                }
            }
        },
    	dataId: {
            validators: {
                notEmpty: {
                    message: '业务数据类型不能为空'
                }
            }
        },
    	isActive: {
            validators: {
                notEmpty: {
                    message: '是否有效不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
CdcEpisodeInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
CdcEpisodeInfoDlg.validate = function () {
    $('#cdcEpisodeInfoForm').data("bootstrapValidator").resetForm();
    $('#cdcEpisodeInfoForm').bootstrapValidator('validate');
    return $("#cdcEpisodeInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
CdcEpisodeInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('cdcEpisodeInfoForm',Sys.backendPath + "/cdc/cdcepisode/add",function(res) {
        Sys.success(res.message);
    	window.parent.CdcEpisode.table.refresh();
        CdcEpisodeInfoDlg.close();
    });
}

/**
 * 提交修改
 */
CdcEpisodeInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('cdcEpisodeInfoForm',Sys.backendPath + "/cdc/cdcepisode/update",function(res) {
        Sys.success(res.message);
    	window.parent.CdcEpisode.table.refresh();
        CdcEpisodeInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("cdcEpisodeInfoForm", CdcEpisodeInfoDlg.validateFields);
});
